﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    UserHelper u = new UserHelper();
    protected void Page_Load(object sender, EventArgs e)
    {
        Literal title = Master.FindControl("title") as Literal;
        title.Text = "宣汉知名律师-宣汉律师-秦锐-首页";
        if (!IsPostBack)
        {
            bind();
        }
    }
    protected void bind()
    {
        Repeater1.DataSource = u.GetIndexInfo(1);
        Repeater2.DataSource = u.GetIndexInfo(2);
        Repeater3.DataSource = u.GetIndexInfo(3);
        Repeater4.DataSource = u.GetIndexInfo(4);
        Repeater5.DataSource = u.Getliuyan();
        Repeater1.DataBind();
        Repeater2.DataBind();
        Repeater3.DataBind();
        Repeater4.DataBind();
        Repeater5.DataBind();
    }
    protected void Repeater5_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Literal li = (Literal)e.Item.FindControl("text_content");
            string tempcontent = li.Text;
            if (tempcontent.Length >= 12)
            {
                li.Text = tempcontent.Substring(0, 12) + "...";
            }
            Literal text_time = (Literal)e.Item.FindControl("text_time");
            DateTime temptime =Convert.ToDateTime(text_time.Text);
            text_time.Text=temptime.GetDateTimeFormats('M')[0].ToString();
        }
    }
}